# Contributor: Galen Abell <galen@galenabell.com>
# Maintainer: Galen Abell <galen@galenabell.com>
pkgname=vdirsyncer
_pyname=$pkgname
pkgver=0.16.8
pkgrel=0
pkgdesc="CLI Synchronization for CalDAV and CardDAV"
url="http://vdirsyncer.pimutils.org"
arch="noarch"
license="BSD-3-Clause"
depends="
	python3
	py3-atomicwrites
	py3-click
	py3-click-log
	py3-click-threading
	py3-requests
	py3-requests-toolbelt
	"
makedepends="py3-setuptools py3-setuptools_scm py3-sphinx"
checkdepends="
	py3-pytest
	py3-hypothesis
	py3-pytest-localserver
	py3-subtesthack
	py3-werkzeug
	"
subpackages="$pkgname-doc"
source="
	https://files.pythonhosted.org/packages/source/${_pyname%${_pyname#?}}/$_pyname/$_pyname-$pkgver.tar.gz
	01-python-click.patch
	"

build() {
	python3 setup.py build
	PYTHONPATH="build:$PYTHONPATH" sphinx-build -b man docs/ build/
}

check() {
	# test_create_collections fails inexplicably
	local pytest_args="--deselect=tests/system/cli/test_sync.py::test_create_collections"
	make DETERMINISTIC_TESTS=true PYTEST_ARGS="$pytest_args" test
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
	install -Dm644 build/$pkgname.1 "$pkgdir"/usr/share/man/man1/$pkgname.1
}

sha512sums="12cb50f592085af37bd9c4207c0d31fdd38fc2a44712eb6288b12e7e7ee9af82070d1d405fa9579e935e545e6c92aafb6f8334ebde4976c4eb9412e78e7c5ada  vdirsyncer-0.16.8.tar.gz
5a1e718c6e7e3cc751ce4a2558dfbd0635d7aec1aef1d7de424887e3df7688c4c30f7c416bd9a4290b572c24b932a3643234ab54fd9d43484d626f5a154f8eda  01-python-click.patch"
